package com.aptoto.thrift.offcial.separation;

/**
 * The set of fields this struct contains, along with convenience methods
 * for finding and manipulating them.
 * @author Orion
 *
 */
public enum MFields implements org.apache.thrift.TFieldIdEnum {
	AA((short) 12, "aa"),
	BB((short) 5, "bb"),
	CC((short) 3, "cc"),
	DD((short) 6, "dd"),
	EE((short) 9, "ee"),
	FF((short) 44, "ff"),
	GG((short) 32, "gg"),
	HH((short) 1, "hh"),
	II((short) 2, "ii");

	private static final java.util.Map<java.lang.String, MFields> byName = new java.util.HashMap<java.lang.String, MFields>();

	static {
		for (MFields field : java.util.EnumSet.allOf(MFields.class)) {
			byName.put(field.getFieldName(), field);
		}
	}

	/**
	 * Find the _Fields constant that matches fieldId, or null if its not found.
	 */
	public static MFields findByThriftId(int fieldId) {
		switch (fieldId) {
		case 12: // AA
			return AA;
		case 5: // BB
			return BB;
		case 3: // CC
			return CC;
		case 6: // DD
			return DD;
		case 9: // EE
			return EE;
		case 44: // FF
			return FF;
		case 32: // GG
			return GG;
		case 1: // HH
			return HH;
		case 2: // II
			return II;
		default:
			return null;
		}
	}

	/**
	 * Find the _Fields constant that matches fieldId, throwing an exception if
	 * it is not found.
	 */
	public static MFields findByThriftIdOrThrow(int fieldId) {
		MFields fields = findByThriftId(fieldId);
		if (fields == null)
			throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
		return fields;
	}

	/**
	 * Find the _Fields constant that matches name, or null if its not found.
	 */
	public static MFields findByName(java.lang.String name) {
		return byName.get(name);
	}

	private final short _thriftId;
	private final java.lang.String _fieldName;

	MFields(short thriftId, java.lang.String fieldName) {
		_thriftId = thriftId;
		_fieldName = fieldName;
	}

	public short getThriftFieldId() {
		return _thriftId;
	}

	public java.lang.String getFieldName() {
		return _fieldName;
	}
}